package com.yunwaikeji.gy_tool_library.compress.picture;

import java.io.File;

public class GYCompressPictureBuilder {
    private String path;//原图文件路径
    private String compressPath;//压缩后的图片文件路径
    private long compressSize = -1;//压缩到多少大小
    private int quality = 100;//压缩精度，尽量>=50
    private int maxWidth = -1;//期望的图片宽度
    private int maxHeight = -1;//期望的图片高度
    private GYCompressPictureCallback GYCompressPictureCallback;

    public GYCompressPictureBuilder setCompressCallback(GYCompressPictureCallback GYCompressPictureCallback) {
        this.GYCompressPictureCallback = GYCompressPictureCallback;
        return this;
    }

    public void build() {
        new GYCompressPictureThread(this, GYCompressPictureCallback).start();
    }

    public String getPath() {
        return path;
    }

    public GYCompressPictureBuilder setPath(String path) {
        this.path = path;
        return this;
    }

    public GYCompressPictureBuilder setPath(File file) {
        return setPath(file.getPath());
    }

    public String getCompressPath() {
        return compressPath;
    }

    public GYCompressPictureBuilder setCompressPath(String compressPath) {
        this.compressPath = compressPath;
        return this;
    }

    public GYCompressPictureBuilder setCompressPath(File compressPath) {
        return setCompressPath(compressPath.getPath());
    }

    public long getCompressSize() {
        return compressSize;
    }

    public GYCompressPictureBuilder setCompressSize(long maxSize) {
        this.compressSize = maxSize;
        return this;
    }

    public int getQuality() {
        return quality;
    }

    public GYCompressPictureBuilder setQuality(int quality) {
        this.quality = quality;
        return this;
    }

    public int getMaxWidth() {
        return maxWidth;
    }

    public GYCompressPictureBuilder setMaxSize(int width, int height) {
        this.maxWidth = width;
        this.maxHeight = height;
        return this;
    }

    public int getMaxHeight() {
        return maxHeight;
    }
}
